﻿using MesBLL.Common;
using MesDAL.DBInfo;
using MesDAL.DTO.ProcessSheet;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MesBLL.EventService
{
    public class WorkPieceInfoService : CommonService<workpiece_info>
    {
        /// <summary>
        /// 测试git
        /// </summary>
        /// <param name="number"></param>
        /// <returns></returns>
        public async Task<workpiece_info> SelectWorkpieceByNumber(string number)
        {
            return await Task.Run(() => GetAll().Where(x => x.number.Equals(number)).FirstOrDefault());
        }

        /// <summary>
        /// 通过工件名称以及订单号检索对应工件信息
        /// </summary>
        /// <param name="number"></param>
        /// <param name="order"></param>
        /// <returns></returns>
        public async Task<workpiece_info> SelectWorkpieceByNumberAndOrder(string number, string order)
        {
            return await Task.Run(() => GetAll().Where(x => x.number.Equals(number) && x.order.Equals(order)).FirstOrDefault());
        }

        public async Task<workpiece_info> SelectWorkpieceById(int id)
        {
            return await Task.Run(() => GetAll().Where(x => x.id == id).FirstOrDefault());
        }

    }
}
